package io.geekidea.boot.baiwang.controller;

import io.geekidea.boot.baiwang.dto.common.Result;
import io.geekidea.boot.baiwang.dto.InvoiceRequest;
import io.geekidea.boot.baiwang.service.InvoiceService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/invoice")
@RequiredArgsConstructor
@Slf4j
public class InvoiceController {

    @Resource
    private InvoiceService invoiceService;

    /**
     * 发票开具
     * @param invoiceRequest
     * @return
     */
    @PostMapping()
    public Result issueInvoice(@RequestBody InvoiceRequest invoiceRequest) {
        log.info("开票请求参数：{}", invoiceRequest);
        return invoiceService.invoice(invoiceRequest);
    }
}
